import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Demo_701 {
    public static void main(String[] args)throws InterruptedException {
        //创建一个阻塞队列
        BlockingQueue<Integer>queue = new LinkedBlockingQueue<>(3);
        //向阻塞队列中添加元素
        queue.put(1);
        queue.put(2);
        queue.put(3);
        System.out.println("已经添加了3个元素");

        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println("已经取出了3个元素");
    }
}
